package com.example.demo.handler;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.kafka.annotation.KafkaListener;
import org.springframework.stereotype.Component;

@Component
public class KafkaHandler {
	private Logger logger = LoggerFactory.getLogger(KafkaHandler.class);

	@KafkaListener(topics = "cw-upgrade",groupId = "org-test")
	private void handler(String message) {
		logger.info("==================================="+message);
		JSONObject msg = JSON.parseObject(message);
		JSONObject content = msg.getJSONObject("content");
		JSONObject response = content.getJSONObject("response");
		logger.info("response==="+JSON.toJSONString(response));
	}

//	@KafkaListener(topics = "RMZK-AI-AUDIT-RESULT",groupId = "media-test-hjuh")
//	private void handler(String message) {
//		logger.info("@@@@@@@@@@@@@@@@@@");
//		if(message.contains("1347206433875169281@02") || message.contains("1347206182145626114@02")
//				|| message.contains("testAppKey_0107wwwwww_1610039794_141@01") || message.contains("testAppKey_0107wwwwww_1610039941_190@01")
//				|| message.contains("testAppKey_0107wwwwww_1610036198_1@01")){
//			logger.info("==================================="+message);
//		}
//	}

}
